Data Sources
App Studio allows you to use data in your mobile apps from the following sources:
-
ADO Databases.
-
RESTful Web APIs via NDL's Connect gateway.
-
SOAP and RESTful Web Services.
-
NDL awi Web Services.
-
Microsoft Outlook Contacts and Appointments.
At runtime, your app can send a request to any of these sources and ask it to send data to the app. We call this downloading data and if you display the data within your app, we say the data is input mapped to the Controls which display the data. You don't have to display downloaded data which users don't need to see.
Within your app, you can display and allow users to edit downloaded data and/or to enter new data and you can manipulate the data within your app using the Digitise Apps Scripting language. Data within the app can be sent from the mobile device to the same remote sources listed above. When data is sent from the mobile device we call it uploading the data and if the data is taken from Controls on a form, we say the Controls are output mapped to the data source.
Data can be passed in either or both directions – i.e. you can both download and upload data within the same app or just upload or just download as needed. You can upload to and download from multiple sources in a single app and you can upload to and download from the same or different sources depending upon the requirements of the app you are creating.
Within your app you need to be able to store data downloaded from a remote source, new data entered by a user and data edited by a user. To store this data, your app will create one or more local databases on each device and add a table to the database for each remote source you specify when you create the app. Within your Project, we call these local tables Data Sources. You can add as many Data Sources to an app as you need within App Studio and you can add more than one Data Source for the same remote source if you want or need to.
When you add a new Data Source to your app, you are effectively specifying the data columns which will define the structure of a local table to hold data associated with a remote source. The columns you specify should match the data you expect to receive from and/or send to the corresponding remote source. This is simplified by allowing you to display the structure of a remote source and then choose those data items within that source that you want to allow for in your app. App Studio will automatically create a database table which includes a column for each data item you select. Data items which you don't need can be ignored. For example, the remote source might include names and addresses but within your app you might only be interested in names and postcodes, meaning you can ignore such things as house number, street name and town.
Where you will be uploading and downloading data to the same remote source, you can use the same Data Source for both. In some cases, however, it might be simpler or more efficient to create separate Data Sources for uploading and downloading, e.g., where the data transferred will be different in each direction.
Data Sources which are linked to the remote sources listed above, can only hold data from and/or for one remote source. If you want to combine data from more than one remote source in a single table on the device, you will need to define your own table and specify its data columns manually. These Data Source tables are called Custom Tables. You can also use Custom Tables to allow for data which isn't linked to a remote source, or to specify SQL queries which aren't allowed for with the standard data sources.
At runtime, when data is downloaded or entered by a user, it will be stored as records in the Data Source's local table, with each record being one row within the table.
- Within this online help, we will refer to remote sources as remote data sources and references to Data Sources signifies local Data Sources.
In addition to the Data Sources discussed above, Digitise Apps also allows you to create Custom Views. Custom Views effectively provide a 'window' onto the data held in the local databases on the device. A SQL Select statement is used to select which records from which tables you want to include within an individual View and you can configure different Views to provide different data sets. Views are mainly used to display data and can be especially useful where you want to combine data from different tables, for example in a ListView. A View is like a virtual table containing the records defined by a SQL statement. You can display the contents of data items in the records and move through the record set but you cannot add new records, update records or download or upload data using a View. To do these things you need to use Custom Tables or the Data Sources themselves.
Once you have defined a Data Source, you can map the data items contained in it to Controls on your forms and/or access and manipulate them in your Scripts. Mapping data items to Controls allows you to display data downloaded to the device and can be used to allow users to modify downloaded records or create new records. Scripts are used to initiate uploads and downloads and can also be used to manipulate data behind the scenes.
For more information about Data Sources and how to define them, see Data Sources in the User Guide section of this online help.